package com.mutual.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mutual.base.page.PageResult;
import com.mutual.dao.IDividendDao;
import com.mutual.entity.Dividend;
import com.mutual.service.IDividendService;

@Service("dividendServiceImpl")
@Transactional(value = "transactionManager")
public class DividendServiceImpl implements IDividendService{

	@Resource(name = "dividendDaoImpl")
	private IDividendDao dividendDao;

	public List<Dividend> listDividendAll(){
		return dividendDao.listDividendAll();
	}

	public void listDividendByPage(PageResult<Dividend> pageResult,Dividend condition){
		int rows = dividendDao.listDividendByPageCount(condition);
		pageResult.setRows(rows);

		RowBounds rowBounds = new RowBounds(pageResult.getCurrentPageIndex(),pageResult.getPageSize());
		List<Dividend> list = dividendDao.listDividendByPage(rowBounds,condition);
		pageResult.setResult(list);
	}

	public Dividend getDividendById(String id){
		return dividendDao.getDividendById(id);
	}

	public void add(Dividend item){
		dividendDao.add(item);
	}

	public void update(Dividend item){
		dividendDao.update(item);
	}

	public void delByIds(String[] ids){
		dividendDao.delByIds(ids);
	}

	@Override
	public void addTeam(Dividend item) {
		dividendDao.addTeam(item);
	}

}

